#include<bits/stdc++.h>
using namespace std;
struct note {
	int num;
	int zl;
};
note m[200010];
int main() {
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n;
	cin>>n;
	int k=n;
	for(int i=1; i<=n; i++) {
		cin>>m[i].zl;
		m[i].num=i;
	}
	while(k!=0) {
		int a[10010],kk=0,kkk=k;
		for(int i=1; i<=k; i++) {
			if(i==1||m[i].zl!=m[i-1].zl) {
				k--;
				cout<<m[i].num<<" ";
				a[kk]=i;
				kk++;
			}
		}
		for(int i=1;i<=kk;i++){
			for(int j=a[kk]+1;j<=kkk;i++){
				m[j].zl=m[j-1].zl;
			}
		}
		cout<<"\n";
	}
	return 0;
}
